const fse = require('fs-extra');
const { logger } = require('./logger');
const { preMoveResPaths } = require('./util');

function moveSync(dest = "") {
    const src = dest.replace("../assets/resources", "../assets/outRes");
    if (!fse.existsSync(src)) return;

    logger.log(`move ${src} to ${dest}`);
    fse.moveSync(src, dest, { overwrite: true });
    fse.moveSync(`${src}.meta`, `${dest}.meta`, { overwrite: true });
    logger.log(`move ${src} to ${dest} done`);
}

logger.log("revertPreMoveRes start");

preMoveResPaths.forEach(moveSync);

fse.emptyDirSync("../assets/outRes/");
fse.removeSync("../assets/outRes/");
fse.unlinkSync("../assets/outRes.meta");

logger.log("revertPreMoveRes done");

